class AddUserFavoriteInfosRelationId < ActiveRecord::Migration
  def self.up
    change_column :user_favorite_subjects, :description, :text
    change_column :user_favorite_infos, :user_favorite_subject_id, :integer, :null => true
    remove_column :user_favorite_infos, :item_id
    add_column    :user_favorite_infos, :relation_id, :integer, :null => false, :after => 'user_favorite_subject_id'
    add_column    :user_favorite_infos, :relation_type, :string, :limit => 100, :null => false, :after => 'relation_id'
    add_column    :user_favorite_infos, :content, :string, :limit => 3000, :after => 'relation_type'
  end

  def self.down
    change_column   :user_favorite_subjects, :description, :string
    add_column      :user_favorite_infos, :item_id, :integer
    remove_column   :user_favorite_infos, :relation_id
    remove_column   :user_favorite_infos, :relation_type
    remove_column   :user_favorite_infos, :content
  end
end
